<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>LB-Admin1.0</title>
        {include file="header"}
    </head>
    <body>
    <div class="x-nav">
        <div style="float: left;margin-left:0px;padding-bottom:20px">
            <form class="layui-form layui-col-space5">
                <div class="layui-input-inline layui-show-xs-block">
                    <input class="layui-input" placeholder="关键词" name="keyword"></div>
                <div class="layui-input-inline layui-show-xs-block">
                    <button class="layui-btn"  lay-submit="" lay-filter="sreach">搜索</button>
                </div>
            </form>
        </div>
        <div style="float: right;">
            <button class="layui-btn layui-btn-danger" onclick="selconfirm()"><i class="layui-icon">&#xe640;</i>确认选择</button>
        </div>
    </div>
    <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
    {empty name='data_list'}
    <blockquote class="layui-elem-quote">没 有 记 录 哦！</blockquote>
    {else}
   <div class="layui-card-body layui-table-body layui-table-main">
       <table class="layui-table layui-form">
        <thead>
        <tr>
            <th class='' style="width:20px;"></th>
            <th>名称</th>
            <th>型号</th>
            <th>库存</th>
        </tr>
        </thead>
        <tbody>
        {foreach $data_list as $key=>$vo}
        <tr data-dbclick>
            <td><input type="radio" name="id" value="{$vo.id}_{$vo.spec_id}_{$vo.price}_{$vo.title}"   lay-skin="primary"></td>
            <td>{$vo.title}</td>
            <td>{$vo.spec_name}</td>
            <td>{$vo.stock}</td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {$page|raw}
    </div>
    <script>
      layui.use(['form'], function(){
        var  form = layui.form;
      });
      function selconfirm (argument) {
        var id = $("input[name='id']:checked").val();
        if(id==undefined)
        {
            layer.msg('请选择项目');
            return;
        }
        $("#goods_id",window.parent.document).val(id.split('_')[0]);
        $("#spec_id",window.parent.document).val(id.split('_')[1]);
        $("#goods_name",window.parent.document).html(id.split('_')[3]);
        $("#name",window.parent.document).val(id.split('_')[3]);
        $("#price",window.parent.document).val(id.split('_')[2]);
           var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
           parent.layer.close(index);
        }
      </script>
    {/empty}
</div></div></div></div>
